import { defineStore } from "pinia";
import { ref } from "vue";
export const useCommonStore = defineStore(
  "common",
  () => {
    let mSelected = ref({});//选择的模版
    let showIframe=ref(true);//标组管理的显示与隐藏
    let showPosts=ref(false);//选择贴文的显示与隐藏
    function setmSelected(data: any) {
      mSelected.value = data;
    }
    function setShowIframe(data: any) {
      showIframe.value = data;
    }
    function setShowPosts(data: any) {
      showPosts.value = data;
    }
    return {
      mSelected,
      showIframe,
      showPosts,
      setmSelected,
      setShowIframe,
      setShowPosts
    };
  },
  {
    persist: {
      key: "commonStore", //存储名称
      storage: sessionStorage, // 存储方式
      paths: ["mSelected","showIframe"],
    },
  }
);
